# config.py
from pydantic_settings import BaseSettings  # 注意新的导入路径
from pydantic import Field
import os


class Settings(BaseSettings):
    # 行情参数
    bar_size: int = Field(default=5, env="BAR_SIZE")

    # 交易参数
    trade_ratio: float = Field(default=0.1, env="TRADE_RATIO")
    max_trades: int = Field(default=65, env="MAX_TRADES")



    # LongPort API配置
    longport_app_key: str = Field(default=os.getenv("LONGPORT_APP_KEY"), env="LONGPORT_APP_KEY")
    longport_app_secret: str = Field(default=os.getenv("LONGPORT_APP_SECRET"), env="LONGPORT_APP_SECRET")
    longport_access_token: str = Field(default=os.getenv("LONGPORT_ACCESS_TOKEN"), env="LONGPORT_ACCESS_TOKEN")

    class Config:
        env_file = ".env"  # 可选：支持.env文件


config = Settings()